SETS

Section: Miscellaneous Library Functions (3X)
Updated: August 7, 1990
Index Return to Main Contents
 

NAME

sets - vector represented sets definitions  

SYNOPSIS

#include sets.f83

sets  

DESCRIPTION

Library for sets represented as vectors. The set is a terminated by a "nil" pointer. This set representation is mainly used for small sets of entry pointer and other non-zero values. "nil" and zero cannot be members of a set. The vocabulary search chain is represented as a set.
: .set ( set -- )
Assuming that the set contains elements that are vocabulary entries this function will display the set in normal set notation:
{ <entries> }
The format is equal to the input notation constant sets.
: ?empty-set ( set -- bool)
Returns "true" if the set is empty else "false".
: ?map-set ( set block[element -- bool] -- )
Conditional set iterator. Calls the conditional block on each element in the set while the block returns "false". The iterator is terminated if the block returns "true" or if the block is empty. The conditional block will receive the element as a parameter and should return a boolean flag.
: ?member-set ( element set -- bool)
Returns "true" if the element is a member of the set else "false".
: append-set ( element set -- )
The element is appended to the set. If the element is already a member of the set no operation is performed. An element cannot occur more than once in a set.
: apply-set ( set -- )
Assuming all elements of the set are entry pointers this words will "execute" all elements once.
: empty-set ( set -- )
Assign the set as the empty set.
: intersection-set ( set1 set2 -- )
Remove elements in both "set1" and "set2" from "set2". "set2" becomes the intersection of the sets.
: map-set ( set block[element -- ] -- )
Set iterator function. Call the block on each element in the set. The block will receive the element as a parameter.
: remove-set ( element set -- )
Remove the element from the set. If the element is not a member of the set no operation is taken.
: set ( size -- )
Used in the following form:
<size> set <set-name> ( -- set)
to create of set for "size"-1 elements. Each element is "cell" bytes and may contain a number or pointer.
vocabulary sets ( -- )
The vector represented set extension vocabulary. Include into the vocabulary search set, "context", to allow access of this library.
: size-set ( set -- num)
Returns the number of element in the set.
: union-set ( set1 set2 -- )
The elements of "set1" are appended to the "set2". "set2" becomes the union of the sets.
: { ( -- ) execution
Used in the following form:
{ <entries> } ( -- set)
to mark the beginning of a constant set of vocabulary entries.
: } ( -- set) immediate
Used in the following form:
{ <entries> } ( -- set)
to mark the end of a constant set of vocabulary entries.
 

INTERNALS

The sets library contains the following internal function to search a set.
: search-set ( element set -- [addr1] or [element addr2 false])
Searches the set for the element. Returns the address, "add1", of the element if found else the element together with the last address, "addr2", and the flag, "false", is returned. Used to implement the functions "add-set", "remove-set", "?member-set" and "intersection-set".
 

SEE ALSO

tile(1), forth(3X), blocks(3X).  

NOTE

The function list is sorted in ASCII order. The type and mode of the entry is indicated together with the parameter stack effect.  

COPYING

Copyright (C) 1990 Mikael R.K. Patel

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled "GNU General Public License" is included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the section entitled "GNU General Public License" may be included in a translation approved by the author instead of in the original English.  

AUTHOR

Mikael R.K. Patel
Computer Aided Design Laboratory (CADLAB)
Department of Computer and Information Science
Linkoping University
S-581 83 LINKOPING
SWEDEN
Email: mip@ida.liu.se
he t!

 

Index

NAME
SYNOPSIS
DESCRIPTION
INTERNALS
SEE ALSO
NOTE
COPYING
AUTHOR

This document was created by man2html, using the manual pages.
Time: 17:16:17 GMT, February 06, 2023